<template>
	<view class="flex-col page">
		<view class="flex-col group">
			<image :src="imgUrl+'16557826849664517298.png'" class="image_1" />
			<view class="flex-col items-center group_1">

				<text class="text_1">{{payState=='success'?'支付成功':'支付失败'}}</text>
				<text class="text_2">支付方式：{{type=='wechat'?'微信支付':(type=='alipay'?'支付宝支付':'')}}</text>
				<text class="text_3">支付时间：{{order.payTime ?  order.payTime : getTime}}</text>
			</view>
			<view class="flex-col items-center group_2">
				<view class="flex-col items-center button" @click="goDetail"><text class="text_4">查看订单</text></view>
				<view class="flex-col items-center button_1" @click="go('/pages/index/index',true)"><text
						class="text_5">返回首页</text></view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				imgUrl: this.$IMG_URL,
				orderId: '',
				type: '',
				payState: '',
				order: {}
			};
		},
		onLoad(option) {
			console.log(option);
			if (option.orderId && option.type && option.payState) {
				this.orderId = option.orderId;
				this.type = option.type;
				this.payState = option.payState;
				this.getDetail(this.orderId);
			}

		},
		computed: {
			getTime() {

				//获取当前时间并打印

				let yy = new Date().getFullYear();
				let mm = new Date().getMonth() + 1;
				mm = mm < 10 ? '0' + mm : mm
				let dd = new Date().getDate();
				dd = dd < 10 ? '0' + dd : dd
				let hh = new Date().getHours();
				hh = hh < 10 ? '0' + hh : hh
				let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes();
				let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds();
				return yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss;

			}
		},
		methods: {
			getDetail(ordersId) {
				this.$http('lorder.queryOrdersInfo', {
					ordersId: ordersId
				}).then(r => {
					if (r.code == 200) {
						this.order = r.data;
					}
				});
			},
			goDetail() {
				let item = this.order;
				// 1全流程咨询 2设计优化 3审核/合同签约 4主材咨询 5施工巡检 6验收 7选材咨询 8全流程管家
				if (item.ordersType == 2) {
					// 设计优化
					uni.redirectTo({
						url: '/pages/my/order/orderDetail6?ordersId=' + item.ordersId
					})
				} else if (item.ordersType == 1) {
					// 全流程咨询
					uni.redirectTo({
						url: '/pages/my/order/orderDetail?ordersId=' + item.ordersId
					})
				} else if (item.ordersType == 3) {
					// 审核 合同签约
					uni.redirectTo({
						url: '/pages/my/order/orderDetail5?ordersId=' + item.ordersId
					})
				} else if (item.ordersType == 4) {
					// 主材咨询
					// this.$u.toast('敬请期待');
					uni.redirectTo({
						url: '/pages/my/order/orderDetailZC?ordersId=' + item.ordersId
					})
				} else if (item.ordersType == 5) {
					// 施工巡检
					uni.redirectTo({
						url: '/pages/my/order/orderDetail4?ordersId=' + item.ordersId
					})
				} else if (item.ordersType == 6) {
					// 验收
					uni.redirectTo({
						url: '/pages/my/order/orderDetail2?ordersId=' + item.ordersId
					})
				} else if (item.ordersType == 7) {
					// 选材咨询
					// this.$u.toast('敬请期待');
					uni.redirectTo({
						url: '/pages/my/order/orderDetailXC?ordersId=' + item.ordersId
					})
				} else if (item.ordersType == 8) {
					// 全流程管家
					uni.redirectTo({
						url: '/pages/my/order/orderDetail8?ordersId=' + item.ordersId
					})
				} else if (item.ordersType == 9) {
					// 全流程管家
					uni.redirectTo({
						url: '/pages/my/order/orderDetail9?ordersId=' + item.ordersId
					})
				}
			},

		},
	};
</script>

<style scoped lang="scss">
	.page {
		background-color: #ffffffff;
		width: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		height: 100%;
	}

	.group {
		padding: 88rpx 0 463rpx;
		flex: 1 1 auto;
		overflow-y: auto;
	}

	.image_1 {
		align-self: center;
		width: 250rpx;
		height: 180rpx;
	}

	.group_1 {
		margin-top: 37rpx;
	}

	.group_2 {
		margin-top: 91rpx;
	}

	.text_1 {
		color: #000000;
		font-size: 32rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 38rpx;
	}

	.text_2 {
		margin-top: 38rpx;
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.text_3 {
		margin-top: 29rpx;
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.button {
		padding: 18rpx 25rpx;
		background-color: #1d6aff;
		border-radius: 36rpx;
		width: 320rpx;
	}

	.button_1 {
		margin-top: 32rpx;
		padding: 18rpx 25rpx;
		background-image: url('https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/617a2ca7e4f1450011362b37/62b127f6d029820011531bae/16557826849630472894.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
		width: 320rpx;
	}

	.text_4 {
		color: #ffffff;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.text_5 {
		color: #1d6aff;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}
</style>
